// 用户相关的接口
import request from "@/utils/request";

/**
 * 账号密码登录
 * @param {String} account 用户
 * @param {String} password 密码
 * @returns 
 */
export const userAccountLogin = ({ account, password }) => {
    return request("/login", "post", { account, password })
}

/** 手机号获取验短信验证码
* @param {String} mobile 手机号
* @returns 
*/
export const userMobileLoginMsg = (mobile) => {
    return request("/login/code", "get", { mobile })
}

/** QQ登录
* @param {String} unionId QQ唯一标识 openId
* @param {String} source 客户端类型 1=pc 2=移动
* @returns 
*/
export const userQQLogin = (unionId, source = 1) => {
    return request("/login/social", "post", { unionId, source })
}

/** QQ绑定的短信验证码
* @param {String} mobile 手机号
* @returns 
*/
export const userQQBindCode = (mobile) => {
    return request("/login/social/code", "get", { mobile })
}

/** QQ绑定登录
* @param {String} unionId QQ唯一标识 openId
* @param {String} mobile 手机号
* @param {String} code 短信验证码
* @returns 
*/
export const userQQBindLogin = ({ unionId, mobile, code }) => {
    return request("/login/social/bind", "get", { unionId, mobile, code })
}

/** 校验用户唯一性
* @param {String} account 用户名
* @returns 
*/
export const userAccountCheck = (account) => {
    return request("register/check", "get", { account })
}
